package com.daidai.testsingleinstance

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.view.View

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

//        if (intent.flags and Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT != 0){
//            androidLog("发生这种情况....")
//            finish()
//            return
//        }

        androidLog("MainActivity taskId:$taskId")
        setContentView(R.layout.activity_main)

        findViewById<View>(R.id.btn1).setOnClickListener {
            val intent = Intent(this,SecondActivity::class.java)
            startActivity(intent)
        }
    }

    override fun onNewIntent(intent: Intent?) {
        super.onNewIntent(intent)
        androidLog("MainActivity onNewIntent taskId:$taskId")
    }

    override fun onDestroy() {
        super.onDestroy()
        androidLog("=============MainActivity destroyed!")
    }
}